//scala -classpath '../target/sweet-0.0.1-SNAPSHOT.497-bin.dir/sweet-0.0.1-SNAPSHOT.497/lib/*' db/mysql/samples.scala
import sweet.helper._
import sweet.helper.jdbc._

val names = List("Anonymous", "Tester1", "Tester2", "Tester3", "sweetscala@googlegroups.com")

val jdbc = JdbcHelper("sample_db", "sample_db123", "jdbc:mysql://localhost/sample_db", "com.mysql.jdbc.Driver")
jdbc.withPStmt("insert into feedback(user_id, author, message, is_private, created_date) values(?,?,?,?,?)"){ pstmt=>
  for(i <- 1 to 1033){
    pstmt.setInt(1, 0)
    pstmt.setString(2, names(Rand.randInt(0, names.length)))
    pstmt.setString(3, "Test message#"+i)
    pstmt.setInt(4, 0)
    pstmt.setDate(5, new java.sql.Date(JDate.mkdatetime(2008, 7, Rand.randInt(1,31), 
      Rand.randInt(0,24), Rand.randInt(0,60), Rand.randInt(0,60)).millis))
    pstmt.executeUpdate
  }
}
